{% extends "base.html" %}
{% import "bootstrap/wtf.html" as wtf %}
{% from "bootstrap/pagination.html" import render_pagination %}

{% block page_content %}
    <div class="page-header">
        <h1>您好, {% if current_user.is_authenticated %}{{ current_user.username }}{% else %}陌生人{% endif %}!</h1>
    </div>
    <div>
        {% if current_user.can(Permission.WRITE_ARTICLES) %}
            {{ wtf.quick_form(form, button_map={'submit': 'primary'}) }}
        {% endif %}
    </div>
    <div class="post-tabs">
        <ul class="nav nav-tabs">
            <li {% if not show_followed %} class="active"{% endif %}>
                <a href="{{ url_for('.show_all') }}">全部</a>
            </li>
            {% if current_user.is_authenticated %}
                <li {% if show_followed %} class="active"{% endif %}>
                    <a href="{{ url_for('.show_followed') }}">我关注的人</a>
                </li>
            {% endif %}
        </ul>
        {% include '_posts.html' %}
    </div>
    <div class="pagination">
        {{ render_pagination(pagination, '.index') }}
    </div>
{% endblock %}}